package com.zimin.cloud.system.controller.api;


import com.zimin.authorize.annotation.Authorize;
import com.zimin.cloud.mine.pojo.system.business.DeptBO;
import com.zimin.shared.annotation.OpLog;
import com.zimin.shared.enums.ModuleEnum;
import com.zimin.shared.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 部门 前端控制器 接口
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:05
 */
@RequestMapping("/sys/dept")
@Api(value = "部门管理api", tags = {"部门管理api"})
public interface IDeptController {

    /**
     * <p>查询部门列表</p>
     *
     * @param deptBO 查询参数
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-13 10:38:12
     */
    @GetMapping("/deptTree")
    @Authorize(hasPerMi = "system:dept:tree")
    @ApiOperation(value = "查询部门列表", notes = "查询部门列表", httpMethod = "GET")
    Result deptTree(DeptBO deptBO);

    /**
     * <p>保存部门</p>
     *
     * @param deptBO
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-14 15:55:52
     */
    @PostMapping
    @Authorize(hasPerMi = "system:dept:save")
    @OpLog(module = ModuleEnum.SYSTEM, action = "保存部门")
    @ApiOperation(value = "保存部门", notes = "保存部门", httpMethod = "POST")
    Result save(@RequestBody @Validated DeptBO deptBO);

    /**
     * <p>修改部门</p>
     *
     * @param deptBO 部门对象
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-14 15:59:22
     */
    @PutMapping
    @Authorize(hasPerMi = "system:dept:update")
    @OpLog(module = ModuleEnum.SYSTEM, action = "修改部门")
    @ApiOperation(value = "修改部门", notes = "修改部门", httpMethod = "PUT")
    Result update(@RequestBody @Validated DeptBO deptBO);

    /**
     * 批量删除部门
     */
    @DeleteMapping
    @Authorize(hasPerMi = "system:dept:delete")
    @OpLog(module = ModuleEnum.SYSTEM, action = "批量删除部门")
    @ApiOperation(value = "批量删除部门", notes = "批量删除部门", httpMethod = "DELETE")
    Result delete(@RequestParam(value = "idList") List<String> idList);
}
